package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.entity.ChargingStandards;
import com.sfzy.mapper.ChargingStandardsMapper;
import com.sfzy.service.ChargingStandardsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChargingStandardsServiceImpl implements ChargingStandardsService {
    @Autowired
    private ChargingStandardsMapper chargingStandardsMapper;

    @Override
    public int insertChargingStandards(ChargingStandards chargingStandards) {
        return chargingStandardsMapper.insertChargingStandards(chargingStandards);
    }

    @Override
    public int deleteChargingStandards(int id) {
        return chargingStandardsMapper.deleteChargingStandards(id);
    }

    @Override
    public int updateChargingStandards(ChargingStandards chargingStandards) {
        return chargingStandardsMapper.updateChargingStandards(chargingStandards);
    }

    @Override
    public ChargingStandards selectChargingStandardsById(int id) {
        return chargingStandardsMapper.selectChargingStandardsById(id);
    }

    @Override
    public PageInfo<ChargingStandards> selectChargingStandards(ChargingStandards chargingStandards, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ChargingStandards> chargingStandards1 = chargingStandardsMapper.selectChargingStandards(chargingStandards);
        PageInfo<ChargingStandards> pageInfo = new PageInfo<>(chargingStandards1);
        return pageInfo;
    }
}
